import http from '@/util/request.js'

export default {
    getUserById: (id) => {
        return http({
            url: `/api/user/id/${id}`,
            method: 'get'
        })
    },
    
    getUserList: (data) => {
        return http({
            url: '/api/user/userList',
            method: 'get',
            params: data
        })
    },
    
    addUser: (data) => {
        return http({
            url: '/api/user/addUser',
            method: 'post',
            data
        })
    },
    
    updateUser: (data) => {
        return http({
            url: '/api/user/updateUser',
            method: 'put',
            data
        })
    },
    
    deleteUser: (id) => {
        return http({
            url: `/api/user/deleteUser/${id}`,
            method: 'delete'
        })
    },
    
    getUserPage: (current, size, data) => {
        // 修改：使用正确的路径和参数传递方式
        return http({
            url: '/api/user/userPage',
            method: 'get',
            params: {
                current: current,
                size: size,
                ...data
            }
        })
    },

    resetPassword: (data) => {
        return http({
            url: '/api/user/resetPassword',
            method: 'put',
            data
        })
    },
}
